﻿using ArduinoAnalyzer.Tokens;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArduinoAnalyzer.SemanticAnalysis
{
    public class TypesTable : List<Type>
    {
        public TypesTable()
        {
            this.AddDefaultTypes();
        }

        private void AddDefaultTypes()
        {
            this.Add(new Type("Void"));
            this.Add(new Type("Int"));
            this.Add(new Type("Long"));
            this.Add(new Type("Unsigned Int"));
            this.Add(new Type("Unsigned Long"));
            this.Add(new Type("Byte"));
            this.Add(new Type("Word"));
            this.Add(new Type("Short"));
            this.Add(new Type("Float"));
            this.Add(new Type("Double"));
            this.Add(new Type("Boolean"));
        }

        public Type GetFromName(string name)
        {
            return this.First(t => t.Name == name);
        }
    }
}
